//引入请求的工具
import ajax from "@/utils/request.js";

//获取我的频道列表的接口
const myChannel = () => {
  return ajax({
    url: "/app/v1_0/user/channels",
    method: "GET"
  });
};

//获取所有的频道的接口
const allChannels = () => {
  return ajax({
    url: "/app/v1_0/channels",
    method: "GET"
  });
};

//批量修改用户频道列表的接口
//参数 id：频道id  seq：顺序序号
const addChannel = ary => {
  return ajax({
    url: "/app/v1_0/user/channels",
    method: "PUT",
    data: {
      channels: ary
    }
  });
};

//批量删除用户频道列表的接口
const delChannel = val => {
  return ajax({
    url: "/app/v1_0/user/channels",
    method: "DELETE",
    data: {
      channels: [val]
    }
  });
};

//导出接口
export { myChannel, allChannels, addChannel, delChannel };
